using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using T2.Logging.Business;
using T2.Logging.ASPMVC.Entity;
using T2.Logging.ASPMVC.Entity.Interface;
using T2.Logging.ASPMVC.Entity.Search;
using T2.Logging.ASPMVC.Entity.Search.Interface;
using T2.Logging.Business.Entities;
using T2.Logging.Business.Entities.Interfaces;
using T2.Logging.ASPMVC.Entity.Translators;
using T2.Logging.Business.Entities.Search.Interfaces;
using T2.Logging.Business.Entities.Search;
using T2.Logging.ASPMVC.ViewModel;
using T2.Logging.Common.Log;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using T2.Logging.Common;

namespace T2.Logging.ASPMVC.Controllers
{
    public partial class LogController : Controller
    {
        
		public ActionResult NewLogForm()
        {
            try
            {
				LogViewModel model = new LogViewModel(true);
				Response.Cache.SetCacheability(HttpCacheability.NoCache);
				return View("NewLogForm", model);
			}
            catch(Exception ex)
			{
				MyLogger.MyLog("T2.Logging","Business","Error occured in LogController Workflow", MyEnum.LogCategories.Error, 10, 7010, System.Diagnostics.TraceEventType.Error, "Unknown Error Has Occured");
				HttpResponseMessage message = new HttpResponseMessage();
                message.ReasonPhrase = "Server error has occured in Log View Controller";
                message.StatusCode = HttpStatusCode.NotFound;
                throw new HttpResponseException(message); 
			}
			
        }

        

        public ActionResult LogAccordion()
        {
            try
            {
				return View("LogAccordion");
			}
            catch(Exception ex)
			{
				MyLogger.MyLog("T2.Logging","Business","Error occured in LogController Workflow", MyEnum.LogCategories.Error, 10, 7010, System.Diagnostics.TraceEventType.Error, "Unknown Error Has Occured");
				HttpResponseMessage message = new HttpResponseMessage();
                message.ReasonPhrase = "Server error has occured in Log View Controller";
                message.StatusCode = HttpStatusCode.NotFound;
                throw new HttpResponseException(message); 
			}
			
        }

        public ActionResult LogSearchAccordion()
        {
            try
            {
				return View("LogSearchAccordion");
			}
            catch(Exception ex)
			{
				MyLogger.MyLog("T2.Logging","Business","Error occured in LogController Workflow", MyEnum.LogCategories.Error, 10, 7010, System.Diagnostics.TraceEventType.Error, "Unknown Error Has Occured");
				HttpResponseMessage message = new HttpResponseMessage();
                message.ReasonPhrase = "Server error has occured in Log View Controller";
                message.StatusCode = HttpStatusCode.NotFound;
                throw new HttpResponseException(message); 
			}
			
        }
		
		public ActionResult UpdateLogForm(string id)
        {
            try
            {
				LogViewModel model = new LogViewModel(true);
				Log_ui tempParam = new Log_ui();
				tempParam.Action = "GetOne";
				tempParam.LogID = Convert.ToInt32(id);
				model.LoadModel(tempParam);
				Response.Cache.SetCacheability(HttpCacheability.NoCache);
				return View("UpdateLogForm", model);
			}
            catch(Exception ex)
			{
				MyLogger.MyLog("T2.Logging","Business","Error occured in LogController Workflow", MyEnum.LogCategories.Error, 10, 7010, System.Diagnostics.TraceEventType.Error, "Unknown Error Has Occured");
				HttpResponseMessage message = new HttpResponseMessage();
                message.ReasonPhrase = "Server error has occured in Log View Controller";
                message.StatusCode = HttpStatusCode.NotFound;
                throw new HttpResponseException(message); 
			}
			
        }


        public ActionResult LogDetails(string id)
        {
            try
            {
				LogViewModel model = new LogViewModel(true);
				Log_ui tempParam = new Log_ui();
				tempParam.Action = "GetOne";
				tempParam.LogID = Convert.ToInt32(id);
				model.LoadModel(tempParam);
				Response.Cache.SetCacheability(HttpCacheability.NoCache);
				return View("LogDetails", model);
			}
            catch(Exception ex)
			{
				MyLogger.MyLog("T2.Logging","Business","Error occured in LogController Workflow", MyEnum.LogCategories.Error, 10, 7010, System.Diagnostics.TraceEventType.Error, "Unknown Error Has Occured");
				HttpResponseMessage message = new HttpResponseMessage();
                message.ReasonPhrase = "Server error has occured in Log View Controller";
                message.StatusCode = HttpStatusCode.NotFound;
                throw new HttpResponseException(message); 
			}
			
        }
		
		public ActionResult LogGrid()
        {
			try
            {
				LogViewModel model = new LogViewModel(false);
				ViewData.Model = model;
				Response.Cache.SetCacheability(HttpCacheability.NoCache);
            	return View("LogGrid");
			}
            catch(Exception ex)
			{
				MyLogger.MyLog("T2.Logging","Business","Error occured in LogController Workflow", MyEnum.LogCategories.Error, 10, 7010, System.Diagnostics.TraceEventType.Error, "Unknown Error Has Occured");
				HttpResponseMessage message = new HttpResponseMessage();
                message.ReasonPhrase = "Server error has occured in Log View Controller";
                message.StatusCode = HttpStatusCode.NotFound;
                throw new HttpResponseException(message);  
			}
        }

		public ActionResult LogSearch()
		{
			try
			{
				LogViewModel model = new LogViewModel(true);
				Response.Cache.SetCacheability(HttpCacheability.NoCache);
				return View("LogSearch", model);
			}
			 catch (Exception ex)
			{
				MyLogger.MyLog("T2.Logging","Business","Error occured in LogController Workflow", MyEnum.LogCategories.Error, 10, 7010, System.Diagnostics.TraceEventType.Error, "Unknown Error Has Occured");
				HttpResponseMessage message = new HttpResponseMessage();
                message.ReasonPhrase = "Server error has occured in Log View Controller";
                message.StatusCode = HttpStatusCode.NotFound;
                throw new HttpResponseException(message); 
			}
		}


		
		


    }
}